import axios from "axios"

const instance = axios.create({
    //公共配置
    timeout:5000,
    
})

// 拦截请求
instance.interceptors.request.use(config=>{
       let token = JSON.parse(localStorage.getItem('token')) 
  
        config.headers.Authorization = `Bearer ${token}`;
        config.headers['content-type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
     
     return config;
},error=>{
    return Promise.reject(error);
})

// instance.interceptors.response.use(config=>{ 
//     return config;
// })

export default instance